#include "../wxsitemresdata.h"
#include "wxspasswordentrydialog.h"
#include <wx/textdlg.h>

namespace {
  wxsRegisterItem<wxsPasswordEntryDialog> Reg( _T( "PasswordEntryDialog" ), _T( "密码输入对话框" ), wxsTTool, _T( "对话框" ), 120, false );
  WXS_ST_BEGIN( wxsPasswordEntryDialogStyles, wxT( "wxOK | wxCANCEL | wxCENTRE | wxWS_EX_VALIDATE_RECURSIVELY | wxTE_PASSWORD" ) );
  WXS_ST_CATEGORY( "wxPasswordEntryDialog" )
  WXS_ST( wxCANCEL )
  WXS_ST( wxCENTRE )
  WXS_ST( wxOK )
  WXS_ST( wxTE_CENTRE )
  WXS_ST( wxTE_NOHIDESEL )
  WXS_ST( wxTE_RIGHT )
  WXS_EXST( wxWS_EX_VALIDATE_RECURSIVELY )
  WXS_ST_END()
}

wxsPasswordEntryDialog::wxsPasswordEntryDialog( wxsItemResData *Data ):
  wxsTool( Data, &Reg.Info, NULL, wxsPasswordEntryDialogStyles, ( flVariable | flId | flSubclass | flExtraCode ) ),
  m_sCaption( wxGetPasswordFromUserPromptStr ),
  m_sMessage( wxEmptyString ),
  m_sDefaultValue( wxEmptyString ) {
}

void wxsPasswordEntryDialog::OnBuildCreatingCode() {
  switch( GetLanguage() ) {
  case wxsCPP:
    AddHeader( _T( "<wx/textdlg.h>" ), GetInfo().ClassName, 0 );
    Codef( _T( "%C(%W, %t, %t, %t, %T, %P);\n" ), m_sMessage.wx_str(), m_sCaption.wx_str(), m_sDefaultValue.wx_str() );
    BuildSetupWindowCode();
    break;
  case wxsUnknownLanguage:
  default:
    wxsCodeMarks::Unknown( _T( "wxsPasswordEntryDialog::OnBuildCreatingCode" ), GetLanguage() );
  }
}


void wxsPasswordEntryDialog::OnEnumToolProperties( M_Code_unused long Flags ) {
  WXS_SHORT_STRING( wxsPasswordEntryDialog, m_sCaption, _T( "Caption" ), _T( "caption" ), wxGetPasswordFromUserPromptStr, false );
  WXS_SHORT_STRING( wxsPasswordEntryDialog, m_sMessage, _T( "Message" ), _T( "message" ), wxEmptyString, false );
  WXS_SHORT_STRING( wxsPasswordEntryDialog, m_sDefaultValue, _T( "Default Value" ), _T( "default_value" ), wxEmptyString, false );
}
